<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI治疗师 - 智能心理健康支持系统</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
    <script src="https://unpkg.com/p5@1.7.0/lib/p5.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-color: #4A90A4;
            --secondary-color: #F5F3F0;
            --accent-color: #2E7D32;
            --warning-color: #FF8A65;
            --text-dark: #2C3E50;
            --text-light: #7F8C8D;
        }
        
        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, var(--secondary-color) 0%, #E8F4F8 100%);
            min-height: 100vh;
        }
        
        .hero-title {
            font-family: 'Playfair Display', serif;
            background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .chat-container {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(74, 144, 164, 0.1);
        }
        
        .message-bubble {
            transition: all 0.3s ease;
        }
        
        .message-bubble:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.1);
        }
        
        .emotion-indicator {
            background: conic-gradient(from 0deg, #4A90A4, #2E7D32, #FF8A65, #4A90A4);
            animation: rotate 3s linear infinite;
        }
        
        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        
        .typing-indicator {
            animation: pulse 1.5s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 0.4; }
            50% { opacity: 1; }
        }
        
        .feature-card {
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(5px);
            transition: all 0.3s ease;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0,0,0,0.1);
        }
        
        #p5-background {
            position: fixed;
            top: 0;
            left: 0;
            z-index: -1;
        }
    </style>
</head>
<body class="text-gray-800">
    <div id="p5-background"></div>
    
    <!-- Navigation -->
    <nav class="bg-white/80 backdrop-blur-md shadow-sm border-b border-gray-100 sticky top-0 z-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between items-center h-16">
                <div class="flex items-center space-x-3">
                    <div class="w-10 h-10 bg-gradient-to-br from-blue-500 to-teal-500 rounded-full flex items-center justify-center">
                        <span class="text-white font-bold text-lg">🤖</span>
                    </div>
                    <span class="text-xl font-semibold text-gray-800">AI治疗师</span>
                </div>
                <div class="hidden md:flex space-x-8">
                    <a href="index.html" class="text-blue-600 font-medium border-b-2 border-blue-600 pb-1">治疗对话</a>
                    <a href="monitoring.html" class="text-gray-600 hover:text-blue-600 transition-colors">情绪监测</a>
                    <a href="crisis.html" class="text-gray-600 hover:text-blue-600 transition-colors">危机支持</a>
                    <a href="support.html" class="text-gray-600 hover:text-blue-600 transition-colors">专业支持</a>
                    <a href="about.html" class="text-gray-600 hover:text-blue-600 transition-colors">关于系统</a>
                </div>
                <button class="md:hidden p-2 rounded-md text-gray-600 hover:text-blue-600">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
                    </svg>
                </button>
            </div>
        </div>
    </nav>

    <!-- Hero Section -->
    <section class="pt-12 pb-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center mb-8">
                <h1 class="hero-title text-4xl md:text-5xl font-bold mb-4 opacity-0" id="main-title">
                    您的AI心理健康伙伴
                </h1>
                <p class="text-lg text-gray-600 max-w-2xl mx-auto mb-6 opacity-0" id="subtitle">
                    24/7智能治疗对话，专业情绪监测，个性化心理健康支持
                </p>
                <button onclick="startChat()" class="bg-gradient-to-r from-blue-500 to-teal-500 text-white px-8 py-3 rounded-full font-medium hover:shadow-lg transform hover:scale-105 transition-all duration-300 opacity-0" id="start-btn">
                    开始对话
                </button>
            </div>
        </div>
    </section>

    <!-- Main Chat Interface -->
    <section class="pb-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
                
                <!-- Left Sidebar - Emotion Status -->
                <div class="lg:col-span-1">
                    <div class="chat-container rounded-2xl p-6 mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-4">当前情绪状态</h3>
                        <div class="text-center mb-4">
                            <div class="w-20 h-20 emotion-indicator rounded-full mx-auto mb-3 flex items-center justify-center">
                                <div class="w-16 h-16 bg-white rounded-full flex items-center justify-center">
                                    <span class="text-2xl" id="current-emotion-emoji">😊</span>
                                </div>
                            </div>
                            <p class="text-sm text-gray-600" id="current-emotion-text">积极</p>
                            <p class="text-xs text-gray-500 mt-1">置信度: <span id="confidence-level">85%</span></p>
                        </div>
                        
                        <div class="space-y-3">
                            <div class="flex justify-between text-sm">
                                <span class="text-gray-600">快乐</span>
                                <div class="w-20 h-2 bg-gray-200 rounded-full overflow-hidden">
                                    <div class="h-full bg-yellow-400 rounded-full" style="width: 75%"></div>
                                </div>
                            </div>
                            <div class="flex justify-between text-sm">
                                <span class="text-gray-600">平静</span>
                                <div class="w-20 h-2 bg-gray-200 rounded-full overflow-hidden">
                                    <div class="h-full bg-blue-400 rounded-full" style="width: 60%"></div>
                                </div>
                            </div>
                            <div class="flex justify-between text-sm">
                                <span class="text-gray-600">焦虑</span>
                                <div class="w-20 h-2 bg-gray-200 rounded-full overflow-hidden">
                                    <div class="h-full bg-orange-400 rounded-full" style="width: 25%"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- Quick Actions -->
                    <div class="chat-container rounded-2xl p-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-4">快速操作</h3>
                        <div class="space-y-3">
                            <button onclick="quickMoodCheck()" class="w-full text-left p-3 rounded-lg bg-blue-50 hover:bg-blue-100 transition-colors">
                                <div class="text-sm font-medium text-blue-800">情绪检查</div>
                                <div class="text-xs text-blue-600">快速评估当前状态</div>
                            </button>
                            <button onclick="breathingExercise()" class="w-full text-left p-3 rounded-lg bg-green-50 hover:bg-green-100 transition-colors">
                                <div class="text-sm font-medium text-green-800">呼吸练习</div>
                                <div class="text-xs text-green-600">缓解压力的技巧</div>
                            </button>
                            <button onclick="crisisSupport()" class="w-full text-left p-3 rounded-lg bg-orange-50 hover:bg-orange-100 transition-colors">
                                <div class="text-sm font-medium text-orange-800">紧急支持</div>
                                <div class="text-xs text-orange-600">危机干预资源</div>
                            </button>
                        </div>
                    </div>
                </div>

                <!-- Main Chat Area -->
                <div class="lg:col-span-2">
                    <div class="chat-container rounded-2xl p-6 h-96 flex flex-col">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="text-lg font-semibold text-gray-800">治疗对话</h3>
                            <div class="flex items-center space-x-2">
                                <div class="w-2 h-2 bg-green-400 rounded-full"></div>
                                <span class="text-sm text-gray-600">在线</span>
                            </div>
                        </div>
                        
                        <div class="flex-1 overflow-y-auto mb-4 space-y-4" id="chat-messages">
                            <div class="message-bubble bg-gradient-to-r from-blue-50 to-teal-50 p-4 rounded-2xl">
                                <div class="flex items-start space-x-3">
                                    <div class="w-8 h-8 bg-gradient-to-br from-blue-500 to-teal-500 rounded-full flex items-center justify-center flex-shrink-0">
                                        <span class="text-white text-sm">🤖</span>
                                    </div>
                                    <div>
                                        <p class="text-gray-800">您好！我是您的AI治疗师。很高兴为您提供心理健康支持。请告诉我，您今天感觉如何？</p>
                                        <p class="text-xs text-gray-500 mt-2">刚刚</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="flex space-x-3">
                            <input type="text" id="chat-input" placeholder="分享您的想法和感受..." class="flex-1 px-4 py-3 border border-gray-200 rounded-2xl focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
                            <button onclick="sendMessage()" class="bg-gradient-to-r from-blue-500 to-teal-500 text-white px-6 py-3 rounded-2xl hover:shadow-lg transition-all duration-300">
                                发送
                            </button>
                        </div>
                    </div>
                </div>

                <!-- Right Sidebar - Analytics -->
                <div class="lg:col-span-1">
                    <div class="chat-container rounded-2xl p-6 mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-4">情绪趋势</h3>
                        <div id="emotion-chart" style="height: 200px;"></div>
                    </div>
                    
                    <div class="chat-container rounded-2xl p-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-4">治疗建议</h3>
                        <div class="space-y-4" id="therapy-suggestions">
                            <div class="p-3 bg-blue-50 rounded-lg">
                                <h4 class="text-sm font-medium text-blue-800 mb-1">深呼吸练习</h4>
                                <p class="text-xs text-blue-600">尝试4-7-8呼吸法来缓解焦虑</p>
                            </div>
                            <div class="p-3 bg-green-50 rounded-lg">
                                <h4 class="text-sm font-medium text-green-800 mb-1">正念冥想</h4>
                                <p class="text-xs text-green-600">每天10分钟的正念练习</p>
                            </div>
                            <div class="p-3 bg-purple-50 rounded-lg">
                                <h4 class="text-sm font-medium text-purple-800 mb-1">感恩日记</h4>
                                <p class="text-xs text-purple-600">记录今天值得感恩的事情</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Features Section -->
    <section class="py-16 bg-white/50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">专业的心理健康支持</h2>
                <p class="text-lg text-gray-600 max-w-2xl mx-auto">
                    基于认知行为疗法和正念疗法的科学方法，为您提供个性化的心理健康支持
                </p>
            </div>
            
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div class="feature-card rounded-2xl p-8 text-center">
                    <div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-teal-500 rounded-2xl mx-auto mb-4 flex items-center justify-center">
                        <span class="text-white text-2xl">💬</span>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">智能对话</h3>
                    <p class="text-gray-600">自然语言处理技术，理解您的情感和困扰，提供个性化的治疗性对话</p>
                </div>
                
                <div class="feature-card rounded-2xl p-8 text-center">
                    <div class="w-16 h-16 bg-gradient-to-br from-green-500 to-emerald-500 rounded-2xl mx-auto mb-4 flex items-center justify-center">
                        <span class="text-white text-2xl">📊</span>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">情绪监测</h3>
                    <p class="text-gray-600">实时分析情绪变化，生成可视化报告，帮助您了解自己的心理健康状态</p>
                </div>
                
                <div class="feature-card rounded-2xl p-8 text-center">
                    <div class="w-16 h-16 bg-gradient-to-br from-orange-500 to-red-500 rounded-2xl mx-auto mb-4 flex items-center justify-center">
                        <span class="text-white text-2xl">🆘</span>
                    </div>
                    <h3 class="text-xl font-semibold text-gray-800 mb-3">危机干预</h3>
                    <p class="text-gray-600">24/7危机检测和紧急支持系统，确保您在需要时获得及时的专业帮助</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-800 text-white py-8">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
            <p class="text-gray-400">© 2024 AI治疗师. 专业的心理健康支持系统. 保护您的隐私是我们的首要责任.</p>
        </div>
    </footer>

    <script src="main.js"></script>
</body>
</html>